package com.java.demoJSON;

import com.google.gson.Gson;

public class Demo2 {
    public static void main(String[] args) {
        //1.  创建Gson对象
        Gson g = new Gson();
        //2.  转换： {"id":"1001","name":"金苹果","info":"种苹果真辛苦"}
        Book book = g.fromJson("{\"id\":\"1001\",\"name\":\"金苹果\",\"info\":\"种苹果真辛苦\"}", Book.class);
        System.out.println(book.getName());

    }
}
